﻿package mortal.game.scene3D.layer3D.utils
{
    import baseEngine.core.*;
    import flash.utils.*;
    import frEngine.pools.*;
    import mortal.game.rules.*;
    import mortal.game.scene3D.player.entity.*;
    import mortal.game.scene3D.player.item.*;

    public class EntityClass extends Object
    {
        private static var _entityClass:Dictionary;

        public function EntityClass()
        {
            return;
        }// end function

        private static function get entityClass() : Dictionary
        {
            if (_entityClass == null)
            {
                _entityClass = new Dictionary();
                _entityClass[EntityType.Player] = UserPlayer;
                _entityClass[EntityType.Mercenary] = UserPlayer;
                _entityClass[EntityType.Boss] = MonsterPlayer;
                _entityClass[EntityType.Transport] = MonsterPlayer;
                _entityClass[EntityType.Pet] = PetPlayer;
                _entityClass[EntityType.DropItem] = ItemPlayer;
            }
            return _entityClass;
        }// end function

        public static function getInstanceByType(param1:Object) : Object
        {
            var _loc_2:* = entityClass[param1] ? (entityClass[param1]) : (param1 as Class);
            var _loc_3:* = FrObjectPool.getObject(_loc_2, "EntityClass") as Pivot3D;
            return _loc_3;
        }// end function

        public static function disposeInstance(param1:Pivot3D, param2:Class = null) : void
        {
            if (param1 && param1.parent != null)
            {
                param1.parent.removeChild(param1);
            }
            if (param1.isDisposed == false)
            {
                FrObjectPool.disposeObject(param1, param2);
            }
            return;
        }// end function

    }
}
